package com.oceansoft.core.dao.util;

public class CheckValueUtil {
	/**
	 * 判断是否为空
	 */
	public static boolean isNotNullValue(Object obj, Class<?> type) {
		if (type.isPrimitive()) {
			// 判断简单类型
			if (type == int.class) {
				return (Integer) obj != Integer.MIN_VALUE ? true : false;
			} else if (type == float.class) {
				return (Float) obj != Float.MIN_VALUE ? true : false;
			} else if (type == double.class) {
				return (Double) obj != Double.MIN_VALUE ? true : false;
			} else if (type == byte.class) {
				return true;
			} else if (type == short.class) {
				return (Short) obj != Short.MIN_VALUE ? true : false;
			} else if (type == long.class) {
				return (Long) obj != Long.MIN_VALUE ? true : false;
			} else if (type == char.class) {
				return true;
			} else if (type == boolean.class) {
				return true;
			} else {
				return true;
			}
		} else {
			// 判断类类型
			if (obj instanceof Integer) {
				// 处理Integer
				return (Integer) obj != Integer.MIN_VALUE ? true : false;
			} else if (obj instanceof Float) {
				return (Float) obj != Float.MIN_VALUE ? true : false;
			} else if (obj instanceof Double) {
				return (Double) obj != Double.MIN_VALUE ? true : false;
			} else if (obj instanceof Short) {
				return (Short) obj != Short.MIN_VALUE ? true : false;
			} else if (obj instanceof Long) {
				return (Long) obj != Long.MIN_VALUE ? true : false;
			} else {
				return obj != null ? true : false;
			}
		}
	}
}
